function upgrade() {
    toast("已经开始");
    threads.start(function() {
        try {
            let options = {
                headers: {
                    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
                    "Referer": "https://gitee.com/"
                }
            };
            let response = http.get("https://gitee.com/honglp/dayu/raw/master/index.js", options);
            if (response.statusCode == 200) {
                let name = 'gxh.js';
                let filePath = files.join(files.cwd(), name);
                log("准备写入文件: " + filePath);
                files.writeBytes(filePath, response.body.bytes());
                log("文件写入成功");
                engines.execScriptFile(filePath);
                toast("远程脚本执行成功");
            } else {
                log("下载远程脚本失败: " + response.statusMessage);
                toast("下载远程脚本失败: " + response.statusMessage);
            }
        } catch (e) {
            log("下载或执行脚本时出错: " + e.message);
            toast("下载或执行脚本时出错: " + e.message);
        }
    });
}
upgrade()